package com.mycompany.myapp;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.mycompany.entity.Number;
import com.mycompany.unity.NumberUnity;

public class T2 {

	
	
	public static void main(String[] args) {
		
		List<Number> ln = getListNum();
		System.out.println("Insert Sample Data :");
		for(Number num: ln){
		System.out.println("number: "+num.getType()+" "+num.getNumber()+" "+num.getPrice());
		}
		System.out.println("End insert Sample Data");
		
		
		// sort number
		Map<String,Map<String,Integer>> mapNumber = NumberUnity.sortingNumber(ln);
		
		
		// print summary data
		NumberUnity.printMap(mapNumber);
		
		Map<String,Integer> test = mapNumber.get("top");
		String indexStr = "";
		for(int i=0;i<10;i++){
			for(int j =0;j<10;j++){
				indexStr = ""+i+""+j;
				if(test.get(indexStr) != null)
				System.out.println("Index : "+ ""+i+""+j+" Value : "+ test.get(indexStr));
			}
		}
			
		
	}
	
	private static List<Number> getListNum(){
		
		List<Number> ln = new ArrayList<Number>();
		
		Number n1 = new Number();
		n1.setType("top");
		n1.setNumber("88");
		n1.setPrice(100);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("top");
		n1.setNumber("77");
		n1.setPrice(200);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("top");
		n1.setNumber("90");
		n1.setPrice(4500);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("top");
		n1.setNumber("77");
		n1.setPrice(500);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("top");
		n1.setNumber("77");
		n1.setPrice(20);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("top");
		n1.setNumber("99");
		n1.setPrice(800);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("down");
		n1.setNumber("90");
		n1.setPrice(100);
		ln.add(n1);
		
		
		n1 = new Number();
		n1.setType("down");
		n1.setNumber("14");
		n1.setPrice(7000);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("down");
		n1.setNumber("14");
		n1.setPrice(10);
		ln.add(n1);
	
		n1 = new Number();
		n1.setType("down");
		n1.setNumber("18");
		n1.setPrice(70);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("down");
		n1.setNumber("18");
		n1.setPrice(10);
		ln.add(n1);
		
		
		n1 = new Number();
		n1.setType("down");
		n1.setNumber("14");
		n1.setPrice(300);
		ln.add(n1);
		
		
		n1 = new Number();
		n1.setType("tod");
		n1.setNumber("123");
		n1.setPrice(300);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("tod");
		n1.setNumber("123");
		n1.setPrice(200);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("tod");
		n1.setNumber("987");
		n1.setPrice(600);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("tang");
		n1.setNumber("233");
		n1.setPrice(100);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("tang");
		n1.setNumber("231");
		n1.setPrice(100);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("tang");
		n1.setNumber("233");
		n1.setPrice(1700);
		ln.add(n1);
		
		
		n1 = new Number();
		n1.setType("tangdown");
		n1.setNumber("443");
		n1.setPrice(120);
		ln.add(n1);
		
		n1 = new Number();
		n1.setType("tangdown");
		n1.setNumber("223");
		n1.setPrice(150);
		ln.add(n1);
		
		return ln;
		
	}
}
